#ifndef __SAHOVSKA_PLOCA_H
#define __SAHOVSKA_PLOCA_H

#include<wx/wx.h>
#include"SahovskoPolje.h"
class Frame;

class SahovskaPloca{
	
	SahovskoPolje *polje[8][8];
	int leftPloce;
	int topPloce;
	//int naPotezu;	//koji igrac je na potezu(npr 0-bijeli, 1-crni)
	//char naPotezu;	//koji igrac je na potezu(npr B-bijeli, C-crni)
	
	Frame* m_frame;
public:
	static int player;
	int x1,y1,x2,y2;
	int oznacenoPolja;
	bool WKing, BKing;
	bool WrongMoveBKingAttack, WrongMoveWKingAttack;
	bool CrniPotez, BijeliPotez;
	int WKingX, WKingY, BKingX, BKingY;//pozicije kraljeva
	int WNapadacX, WNapadacY, BNapadacX, BNapadacY;
	SahovskaPloca();
	~SahovskaPloca();
	void NacrtajPlocu(wxPaintDC *dc);
	int GetPoljeVelicina(int i,int j);
	void NacrtajFigure(wxDC *destDC);
	void OznaciPolje(int x, int y);
	void OdZnaciPolja();
	void GetOznacenaPolja(int *x1, int *y1, int *x2, int *y2);
	void Potez(int *x1, int *y1, int *x2, int *y2);
	bool DozvoljenPotez(int *x1, int *y1, int *x2, int *y2);
	bool IstaDijagonala(int x1, int y1, int x2, int y2);
	bool IstaParalela(int x1, int y1, int x2, int y2);
	bool FiguraNaPutu(int x1, int y1, int x2, int y2);
	bool UndoPotez(int *x1, int *y1, int *x2, int *y2);
	bool WKingUnderAttack();
	bool BKingUnderAttack();
	bool WKingCkeckMate();
	bool BKingCheckMate();
	bool GetWrongMoveBKingAttack();
	bool GetWrongMoveWKingAttack();
	void SetTkoPovlaciPotez(int x, int y);
	bool GetCrniPotez();
	bool GetBijeliPotez();
	int NumOfWhitePieces();
	int NumOfBlackPieces();
	bool PiecesOnInitialPosition();   
	void init();
	SahovskoPolje* GetPolje(int x, int y);
	void SetFrame(Frame* );
};

#endif